#ifndef GETPOST_H
#define GETPOST_H

#include <QTcpSocket>
#include <QObject>

class GetPost : public QObject
{
    Q_OBJECT
public:
    explicit GetPost(QObject *parent = nullptr);

    void onReadyRead();
    void onError(QAbstractSocket::SocketError socketError);

public slots:
    void connectToServer(const QString &host, quint16 port);
    void sendMessage(const QString &message);

signals:
    void connected();
    void disconnected();
    void messageSent();
    void messageReceived(const QString &message);
    void errorOccurred(const QString &errorMessage);

private:
    QTcpSocket *socket;
};

#endif // GETPOST_H
